/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-06-01 14:57:59
 * @LastEditTime : 2023-06-01 14:58:51
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\TestCategory.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList } from '../Common/common'
import { AddDataButton, ModDataButton, DelDataButton } from '../Common/options'

export const TestCategory = async ({ url, OptionsEvent, Permission }) => {
    let data = {
        pageSize: 10,
        params: { pageIndex: 1, OrderField: 'code@asc' },
        hideInSearch: true,
        get: API_LIST()[`get${url}`],
        added: `pos${url}`,
        modify: `put${url}`,
        delete: `del${url}`,
        options: [
            Permission.findIndex(v => v.uuid === 'e3d96a09-570b-4d7f-a8d3-542dcfd9f3ed') !== -1 && (
                <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="新增" />
            ),
        ],
        columns: [
            commonTableList.uuid,
            { ...commonTableList.code, rules: true },
            { ...commonTableList.tableName, title: '类别名称' },
            commonTableList.createUserName,
            commonTableList.createTime,
            commonTableList.updateUserName,
            commonTableList.updateTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 200,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === '1adce74c-ee80-4326-849f-78947347c292') !== -1 && (
                            <ModDataButton OptionsEvent={OptionsEvent} key="modify" title="修改" data={record} />
                        ),
                        Permission.findIndex(v => v.uuid === '053e9e5e-a346-419b-a4df-227cd51802ec') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url={url}
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return data
}
